package org.jeecg.modules.demo.socket.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.demo.socket.entity.ZyAppDyna;
import org.jeecg.modules.demo.socket.service.IZyAppDynaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @Description: zy_app_dyna
 * @Author: jeecg-boot
 * @Date:   2023-07-11
 * @Version: V1.0
 */
@Api(tags="zy_app_dyna")
@RestController
@RequestMapping("/socket/zyAppDyna")
@Slf4j
public class ZyAppDynaController extends JeecgController<ZyAppDyna, IZyAppDynaService> {
	@Autowired
	private IZyAppDynaService zyAppDynaService;
	
	/**
	 *   添加
	 * @param
	 * @return
	 */
	@AutoLog(value = "问题上报")
	@ApiOperation(value="问题上报", notes="问题上报")
	@PostMapping(value = "/add")
	public Result<String> add(HttpServletRequest request,  @RequestParam(value = "photos") List<MultipartFile> photos,String content,@RequestParam(value = "user_ids") List<String> user_ids) {
		zyAppDynaService.add(request,photos,content,user_ids);
		return Result.OK("问题上报成功");
	}

	@AutoLog(value = "问题反馈")
	@ApiOperation(value="问题反馈", notes="问题反馈")
	@PostMapping(value = "/feedback")
	public Result<String> feedBack(HttpServletRequest request,  @RequestParam(value = "photos") List<MultipartFile> fdPhotos,String fdBack,@RequestParam(value = "user_ids") List<String> user_ids,String dyan_id) {
		zyAppDynaService.feedBack(request,fdPhotos,fdBack,user_ids,dyan_id);
		return Result.OK("问题反馈成功");
	}

	@AutoLog(value = "问题获取")
	@ApiOperation(value="问题获取", notes="问题获取")
	@PostMapping(value = "/get")
	public Result<List<ZyAppDyna>> get(HttpServletRequest request) {

		return zyAppDynaService.get(request);
	}

}
